<!-- <template>
  <a-spin :spinning="loading">
    <a-tabs v-model:activeKey="resume"  animated style="margin-left: 20px">
      <a-tab-pane tab="锁定简历列表" key="lockPositionReq" :forceRender="true">
        <j-vxe-table
          :keep-source="true"
          resizable
          ref="resumeEvaluateRecordTableRef"
          :loading="lockResumeListTable.loading"
          :columns="lockResumeListTable.columns"
          :dataSource="lockResumeListTable.dataSource"
          :height="340"
          :disabled="disabled"
          :rowNumber="true"
          :rowSelection="false"
          :toolbar="false"/>
      </a-tab-pane>
    </a-tabs>
  </a-spin>
</template>

<script lang="ts">
  import { defineComponent, ref, reactive, computed } from 'vue';
  import { queryLockResumeListByMainId } from '../PositionReq.api';
  import { JVxeTable } from '/@/components/jeecg/JVxeTable';
  import {lockResumeListColumns} from '../PositionReq.data';

  export default defineComponent({
    name: "PostionReqLockResumeForm",
    components:{
      JVxeTable,
    },
    props:{
      formDisabled:{
        type: Boolean,
        default: false
      },
      formData: { type: Object, default: ()=>{} },
      formBpm: { type: Boolean, default: true }
    },
    emits:['success'],
    setup(props) {
      const loading = ref(false);
      const lockResumeListTable = reactive<Record<string, any>>({
        loading: false,
        columns: lockResumeListColumns,
        dataSource: []
      });
      
      const activeKey = ref('lockPositionReq');
      const formItemLayout = {
        labelCol: {style: { width: '100px' }},
        wrapperCol: {},
      };

      // 表单禁用
      const disabled = computed(()=>{
        if(props.formBpm === true){
          if(props.formData.disabled === false){
            return false;
          }else{
            return true;
          }
        }
        return props.formDisabled;
      });

      async function edit(row) {
        //子表数据
        const recordDataList = await queryLockResumeListByMainId(row['id']);
        lockResumeListTable.dataSource = [...recordDataList];
      }

      return {
        lockResumeListTable,
        activeKey,
        loading,
        formItemLayout,
        disabled,
        edit
      }
    }
  });
</script> -->



<template>
   <BasicTable @register="registerTable"  @row-dbClick="rowDbClick">
    </BasicTable>
    <ResumeDrawer @register="registerDrawer" @success="handleSuccess" :showFooter="showFooter"></ResumeDrawer>
</template>

<script lang="ts" name="tm-resume" setup>
  import {ref, reactive, computed, unref} from 'vue';
  import {BasicTable, useTable} from '/@/components/Table';
  import { useListPage } from '/@/hooks/system/useListPage'
  import {useModal} from '/@/components/Modal';
 
  import {poistionReqLockcolumns, searchFormSchema, superQuerySchema} from '@/views/tm/resume/Resume.data';
  import {lockPositionReqRecordList} from '@/views/tm/resume/Resume.api';
  import ResumeDrawer from '@/views/tm/resume/components/ResumeDrawer.vue'

  import {downloadFile} from '/@/utils/common/renderUtils';
  import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
  import JSelectMultiple from '/@/components/Form/src/jeecg/components/JSelectMultiple.vue';
  import { useUserStore } from '/@/store/modules/user';
  import {useDrawer} from "@/components/Drawer";
  import JInput from '/@/components/Form/src/jeecg/components/JInput.vue';
  const showFooter = ref(true);
  const formRef = ref();
  //const queryParam = reactive<any>({
  const queryParam = reactive<Record<string, any>>({
    positionReqId:''
  });
  const checkedKeys = ref<Array<string | number>>([]);
  //注册model
  const [registerModal, {openModal}] = useModal();
  const [registerDrawer, { openDrawer }] = useDrawer();
  const [registerLockPostionReqDrawer, { openDrawer: openLockPostionReqDrawer }] = useDrawer();
  const userStore = useUserStore();
  const regResumeAssignModal = ref();
  const regResumeLockModal = ref();
  const registerEvaluateModal = ref();
  const registerOutsourcePersonAccountModal = ref();
   //注册table数据
  const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
      tableProps:{
           title: '简历',
           api: lockPositionReqRecordList,
            columns : poistionReqLockcolumns,
           canResize:false,
           useSearchForm: false,
           showActionColumn:false,
           beforeFetch: (params) => {
             return Object.assign(params, queryParam);
           },
        },
    })

  const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext

   
  function rowDbClick(record, index, event) {
    handleDetail(record);
  }

  function handleQuery(positionReqId) {
    queryParam.positionReqId = positionReqId
  }
   /**
    * 详情
   */
  function handleDetail(record: Recordable) {
     // openModal(true, {
     //   record,
     //   isUpdate: true,
     //   showFooter: false,
     // });
     showFooter.value = false;
     openDrawer(true, {
       record,
       disableSubmit:true,
       isUpdate: true,
       showFooter: false,
     });
   }
  /**
   * 分配锁定
   */
  function handleResumeLock(record: Recordable) {
    // regResumeAssignModal.value.disableSubmit = false;
    // regResumeAssignModal.value.personAssign(record);
    regResumeLockModal.value.disableSubmit = false;
    regResumeLockModal.value.resumeLock(record);
    
  }
  /**
   * 入项
   */
  function handlePersonEntry(record: Recordable) {
    registerOutsourcePersonAccountModal.value.disableSubmit = false;
    registerOutsourcePersonAccountModal.value.personEntry(record);
  }
  /**
   * 面试评价
   */
  function handleResumeEvaluate(record: Recordable) {
    // console.log(registerEvaluateModal.value)
    registerEvaluateModal.value.disableSubmit = false;
    registerEvaluateModal.value.addResumeEvaluate(record);
    // registerModal.value.disableSubmit = false;
    // registerModal.value.add();
  }
   /**
    * 成功回调
    */
  function handleSuccess() {
      (selectedRowKeys.value = []) && reload();
   }



  /* ----------------------以下为原生查询需要添加的-------------------------- */
  const toggleSearchStatus = ref<boolean>(false);
  const labelCol = reactive({
    xs:24,
    sm:4,
    xl:6,
    xxl:4
  });
  const wrapperCol = reactive({
    xs: 24,
    sm: 20,
  });
  /**
   * 重置
   */
  function searchReset() {
    formRef.value.resetFields();
    selectedRowKeys.value = [];
    //刷新数据
    reload();
  }
  defineExpose({
    handleQuery,
    queryParam
  });
</script>
<style lang="less" scoped>
  .jeecg-basic-table-form-container {
    padding: 0;
  .table-page-search-submitButtons {
    display: block;
    margin-bottom: 24px;
    white-space: nowrap;
  }
  .query-group-cust{
    min-width: 100px !important;
  }
  .query-group-split-cust{
    width: 30px;
    display: inline-block;
    text-align: center
  }
  }
</style>
